<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML5 Server-Sent Events</title>
</head>

<body>
    <script>
        const eventSource = new EventSource('http://127.0.0.1:3000/stream');

        eventSource.onmessage = event => {
            const currentTime = event.data;
            console.log('当前时间', currentTime);
        };

        eventSource.onerror = error => {
            console.error('Error occurred:', error);
        };
    </script>
</body>

</html>